//生产者和消费者都需要添加配置,将配置放在common项目中
//package com.business.config;
//
//import org.springframework.amqp.core.Binding;
//import org.springframework.amqp.core.BindingBuilder;
//import org.springframework.amqp.core.Queue;
//import org.springframework.amqp.core.TopicExchange;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
///**
// * @Description: TODO rabbitmq topic 主题交换机
// * @Author: mis_wu
// * @Date: 2022/7/29
// **/
//@Configuration
//public class TopicRabbitConfig {
//
//    //rabbit mq 消息前缀
//    public static final String RABBIT_MQ_PREFIX = "business-topic.";
//
//    /**
//     * 绑定键
//     * TODO: *.XXX.*    *表示必须出现的单词,匹配类型如: lis.XXX.cs
//     * TODO: XXX.#   #表示任意数量单词(零个或多个),匹配类型如: XXX.topic,XXX.lis等
//     */
//
//    public static final String BUSINESS_TOPIC_KEY = RABBIT_MQ_PREFIX + "test";
//    public static final String BUSINESS_TOPIC_KEY1 = RABBIT_MQ_PREFIX + "test1";
//    public static final String BUSINESS_TOPIC_KEY2 = "*." + RABBIT_MQ_PREFIX + "*";
//    public static final String BUSINESS_TOPIC_KEY3 = RABBIT_MQ_PREFIX + "#";
//
//    //交换机名称
//    public static final String BUSINESS_TOPIC_EXCHANGE_NAME = "business-topic-exchange";
//
//    @Bean
//    public Queue testQueue(){
//        return new Queue(TopicRabbitConfig.BUSINESS_TOPIC_KEY);
//    }
//
//    @Bean
//    public Queue test1Queue(){
//        return new Queue(TopicRabbitConfig.BUSINESS_TOPIC_KEY1);
//    }
//
//    @Bean
//    public Queue leftAndRightAllQueue(){
//        return new Queue(TopicRabbitConfig.BUSINESS_TOPIC_KEY2);
//    }
//
//    @Bean
//    public Queue rightJinQueue(){
//        return new Queue(TopicRabbitConfig.BUSINESS_TOPIC_KEY3);
//    }
//
//    @Bean
//    TopicExchange exchange(){
//        return new TopicExchange(BUSINESS_TOPIC_EXCHANGE_NAME);
//    }
//
//    //将firstQueue和topicExchange绑定,而且绑定的键值为topic.man
//    //这样只要是消息携带的路由键是topic.man,才会分发到该队列
//    @Bean
//    Binding bindingExchangeMessage(){
//        return BindingBuilder.bind(testQueue()).to(exchange()).with(BUSINESS_TOPIC_KEY);
//    }
//
//    @Bean
//    Binding bindingExchangeMessage2() {
//        return BindingBuilder.bind(test1Queue()).to(exchange()).with(BUSINESS_TOPIC_KEY3);
//    }
//
//}
